package org.blogwu.learn.multithread.chapter2.demo5;

/**
 * join 测试
 *
 * @author hyf
 * @date 2018-09-15
 **/
public class JoinMain {

    public volatile static int i = 0;

    public static class AddClass extends Thread {
        @Override
        public void run() {
            for (i = 0; i < 1000; i++) ;
        }
    }

    public static void main(String[] args) {
        AddClass addClass = new AddClass();
        addClass.start();
        try {
            addClass.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(i);

    }
}
